import { setToken, getToken, removeToken } from '@/utils/storage'
const state = {
  user: {
    userId: 1,
    userName: '肖战'
  },
  tokenInfo: getToken()
}

const mutations = {
  setToken(state, payLoad) {
    state.tokenInfo = payLoad
    setToken(payLoad)
    // localStorage.setItem(TOKEN_KEY, JSON.stringify(payLoad))
  },
  removeToken(state) {
    state.tokenInfo = ''
    removeToken()
  },
  setUserInfo(state, payLoad) {
    state.userInfo = payLoad
  }
}

const actions = {}

const getters = {}

export default {
  state,
  mutations,
  actions,
  getters,
  namespaced: true
}
